<template>
	<view class="u-padding-60">
		<u-time-line>
			<template v-for="(log,index) in logs">
				<u-time-line-item nodeTop="2" v-if="index==0">
					<!-- 此处自定义了左边内容，用一个图标替代 -->
					<template v-slot:node >
						<view class="u-node" style="background: #19be6b;">
							<!-- 此处为uView的icon组件 -->
							<u-icon name="pushpin-fill" color="#fff" :size="24"></u-icon>
						</view>
					</template>
					<template v-slot:content>
						<view>
							<view class="u-order-title">{{log.nickname}}</view>
							<view class="u-order-desc">{{log.desc}}</view>
							<view class="u-order-time">{{$u.timeFormat(log.created, 'yyyy年mm月dd日 hh:MM:ss')}}</view>
						</view>
					</template>
				</u-time-line-item>
				<u-time-line-item v-if="index>0">
					<!-- 此处自定义了左边内容，用一个图标替代 -->
					<template v-slot:content>
						<view>
							<view class="u-order-title">{{log.nickname}}</view>
							<view class="u-order-desc">{{log.desc}}</view>
							<view class="u-order-time">{{$u.timeFormat(log.created, 'yyyy年mm月dd日 hh:MM:ss')}}</view>
						</view>
					</template>
				</u-time-line-item>
			</template>
			<!--  -->
		</u-time-line>
		<wx-share :title='shop.name' :desc="shop.store_introduction" :imgUrl="shop.cover" link="/" ref="wxs"></wx-share>
	</view>

</template>

<script>
	export default {
		data() {
			return {
				scrollTop: 0,
				logs: [{}],
				paymentId: 0,
				user: {},
				paging: {
					current_page: 1,
					total_pages: 1,
					page_zie: 100
				},
				loadStatus: 'loadmore',
				loadText: {
					loadmore: '加载更多',
					loading: '努力加载中',
					nomore: '没有更多了'
				},
				shop: {}
			}
		},
		onLoad(options) {
			this.paymentId = options.payment_id;
			this.getShop()
		},
		onShow() {
			this.getUserInfo();
			this.getLogList();
		},
		methods: {
			getShop() {
				this.$u.post('/shopping/shop-setting', {}).then(res => {
					this.shop = res;
				}).catch(e => {

				})
			},
			getUserInfo() {
				this.$u.post('/user/info', {}).then(res => {
					this.user = res;
					if (this.user.referral_id == 0) {
						this.user.referral_id = '';
					}
				}).catch(e => {
					console.log(e)
				})
			},
			getLogList() {
				this.$u.post('/payment/payment-logs', {
					payment_id: this.paymentId
				}).then(res => {
					this.logs = res;
				}).catch(e => {
					console.log(e)
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.u-node {
		width: 44rpx;
		height: 44rpx;
		border-radius: 100rpx;
		display: flex;
		justify-content: center;
		align-items: center;
		background: #d0d0d0;
	}

	.u-order-title {
		color: #333333;
		font-weight: bold;
		font-size: 32rpx;
	}

	.u-order-desc {
		color: rgb(150, 150, 150);
		font-size: 28rpx;
		margin-bottom: 6rpx;
	}

	.u-order-time {
		color: rgb(200, 200, 200);
		font-size: 26rpx;
	}
</style>
